Skip to content

Conversation

@gengliangwang
Copy link
Member

@gengliangwang gengliangwang commented Apr 18, 2022

What changes were proposed in this pull request?

  1. change the exception type from java.lang.NumberFormatException to SparkNumberFormatException
  2. Show the exact target data type in the error message

Before change:

java.lang.NumberFormatException
invalid input syntax for type numeric: '123.a'. ...

After change:

org.apache.spark.SparkNumberFormatException
invalid input syntax for type INT: '123.a'. ...

Why are the changes needed?

Error message improvement

Does this PR introduce any user-facing change?

Yes, improving the exception type and message of casting string to numbers under ANSI mode.

How was this patch tested?

UT

@gengliangwang
Copy link
Member Author

cc @entong as well

@gengliangwang
Copy link
Member Author

As per #36241 (comment), I added @anchovYu as co-author

@gengliangwang gengliangwang changed the title [SPARK-38935][SQL] Improve the exception type and message of casting string to numbers [WIP][SPARK-38935][SQL] Improve the exception type and message of casting string to numbers Apr 19, 2022
@gengliangwang
Copy link
Member Author

@gengliangwang
Copy link
Member Author

Closing this one since there is #36241

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants